<?php
class Item_view_section_coordinates_model extends MY_Model{
	function __construct(){
		parent::__construct();
		$this->loadfields();
	}
	

	function getDistinctSectionByView($itemview = ""){
		if($itemview != ""){
			$this->db->select("*");
			$this->db->select("isec.name as section_name");
			$this->db->where("obj.item_view_id", $itemview);
			$this->db->join("item_section isec" , "isec.id = obj.item_section_id" , "inner");
			$this->db->group_by("obj.item_section_id");
			$result = $this->db->get($this->table()." as obj");
			return $result->result_array();
		}
		return null;
	}
	
	function getCoordinatesListByView($itemviewid = ""){
		if($itemviewid != ""){
			$this->db->select("*");
			$this->db->where("obj.item_view_id", $itemviewid);
			$this->db->where("obj.valid", 1);
			$result = $this->db->get($this->table()." as obj");
			return $result->result_array();
		}
	}
	
}